local lunwei = fk.CreateSkill({
  name = "lingling__lunwei",
})

Fk:loadTranslationTable{
  ["lingling__lunwei"] = "论味",
  [":lingling__lunwei"] = "出牌阶段限一次，你可以与一名其他角色拼点，赢者获得一张【酒】，若不为你，你对其造成2点火焰伤害。",

  ["#lingling__lunwei"] = "论味：与一名角色拼点，赢者获得一张【酒】，若没赢则对其造成伤害",
}

lunwei:addEffect("active", {
  anim_type = "offensive",
  prompt = "#lingling__lunwei",
  max_phase_use_time = 1,
  card_num = 0,
  target_num = 1,
  can_use = function(self, player)
    return not player:isKongcheng() and player:usedSkillTimes(lunwei.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0 and to_select ~= player and player:canPindian(to_select)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    local pindian = player:pindian({target}, lunwei.name)
    local winner = pindian.results[target].winner
    if winner and not winner.dead then
      local card = room:getCardsFromPileByRule("analeptic", 1, "allPiles")
      if #card > 0 then
        room:moveCardTo(card, Card.PlayerHand, winner, fk.ReasonJustMove, lunwei.name, nil, true, winner)
      end
    end
    if winner ~= player and not player.dead and not target.dead then
      room:damage{
        from = player,
        to = target,
        damage = 2,
        skillName = lunwei.name,
        damageType = fk.FireDamage,
      }
    end
  end,
})

return lunwei
